#include "../../../code/server/common/asr.hpp"

#include <gflags/gflags.h>

DEFINE_string(app_id, "120291017", "语音平台应用ID");
DEFINE_string(api_key, "BMgDVm4hBigsm2ng6T0BRMgj", "语音平台API秘钥");
DEFINE_string(secret_key, "TOe3Ir1kgf1yxRQmNjnPMe0XvHoJcLxk", "语音平台加密秘钥");

DEFINE_bool(run_mode, false, "程序的运行模式，false-调试； true-发布；");
DEFINE_string(log_file, "", "发布模式下，用于指定日志的输出文件");
DEFINE_int32(log_level, 0, "发布模式下，用于指定日志输出等级");

int main(int argc, char *argv[])
{
    google::ParseCommandLineFlags(&argc, &argv, true);
    zjx_im::init_logger(FLAGS_run_mode, FLAGS_log_file, FLAGS_log_level);

    zjx_im::ASRClient client(FLAGS_app_id, FLAGS_api_key, FLAGS_secret_key);

    std::string file_content;
    aip::get_file_content("16k.pcm", &file_content);
    std::string err;
    std::string ret = client.recognize(file_content, err);

    if(ret.empty())
    {
        return -1;
    }
    std::cout << ret << std::endl;
}
